package com.itmg.tools.format;

import java.util.ArrayList;
import java.util.List;

import com.itmg.vo.SearchResultItemVO;

/**
 * 操作List的工具类
 * @author Jason
 *
 */
public class FormatListUtil {

	public FormatListUtil() {
		
	}
	
	/**
	 * 将List中的商品整理，将没有价格的商品放到最后
	 */
	public static List<SearchResultItemVO> getFormatList(List<SearchResultItemVO> resultList){
		
		List<SearchResultItemVO> list = new ArrayList<SearchResultItemVO>();
		if(resultList != null){
			List<SearchResultItemVO> startList = new ArrayList<SearchResultItemVO>();
			List<SearchResultItemVO> endList = new ArrayList<SearchResultItemVO>();
			for(SearchResultItemVO searchResultItemVO : resultList){
				if(searchResultItemVO.getLowestPrice() != 0 && !"".equals(searchResultItemVO.getLowestPrice())){
					startList.add(searchResultItemVO);
				}
				else{
					endList.add(searchResultItemVO);
				}
			}
			list.addAll(startList);
		}
		else
			return resultList;
		return list;
	}

}
